using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Collections;
using Org.Eurekaa.DNJ.Helpers.LitJson;

namespace Org.Eurekaa.DNJ.Config
{
    public class DNJConfigFunction
    {
        public string Name;
        public string Assembly;
        public string Type;


        public DNJConfigFunction(string name, string assembly, string type)
        {
            this.Name = name;
            this.Assembly = assembly;
            this.Type = type;
        }
        public DNJConfigFunction() { }

    }

    public class DNJConfiguration
    {
        public List<DNJConfigFunction> Functions;


        public DNJConfiguration() {
            this.Functions = new List<DNJConfigFunction>();
        }
        public DNJConfiguration(List<DNJConfigFunction> functions) 
        {
            this.Functions = functions;
        }

    }

    public class ConfigReader
    {
        public static DNJConfiguration GetConfiguration(string ConfigFilePath)
        {
            try
            {
                string jsonStr = File.ReadAllText(ConfigFilePath);
                return JsonMapper.ToObject<DNJConfiguration>(jsonStr);
            }
            catch (Exception ex)
            {
                return null;
            }
        }
    }
}
